import type { RouteObject } from 'react-router-dom';
import { createBrowserRouter, RouterProvider } from 'react-router-dom';
import { useState, memo } from 'react';
import { baseRoutes } from './modules';

const RouteView = memo(() => {
  const [route, setRoute] = useState(baseRoutes);

  const routeEl = createBrowserRouter(route as RouteObject[]);
  return <RouterProvider router={routeEl} />;
});

export default RouteView;
